//
//  YZPigModel.m
//  VET
//
//  Created by 刘文靖 on 2018/7/18.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPigModel.h"
#import "YZAutoItemModel.h"
#import "NSDate+YZDatePickView.h"
@implementation YZPigModel
+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"pigId" : @"id"
             };
}

- (NSString *)pigBirthdateStr{
    if (!_pigBirthdateStr) {
        _pigBirthdateStr = [NSString stringWithFormat:@"%@天",[NSDate distanceTimeWithBeforeTime:self.swineBirthdate]];
    }
    return _pigBirthdateStr;
}
//猪只1000012（种猪/母猪/怀孕)
- (NSString *)pigOptionStr{
    if (!_pigOptionStr) {
        _pigOptionStr = [NSString stringWithFormat:@"猪只%@  (%@/%@/%@)",self.earMark,self.swineClass.itemValue,self.swineSex.itemValue,self.swineState.itemValue?:@"未确定"];
    }
    return _pigOptionStr;
}
@end

@implementation YZPigModelAPI

+ (RACSignal*)requestSwineList:(NSInteger)index earMark:(NSString *)earMark type:(NSString *)type{
    YZPigModelAPI *api = [YZPigModelAPI api];
    api.action = @"/api/swine";
    api.showLoadingStatus = NO;
    if (earMark) {
        [api addParam:@"earMark" value:earMark];
    }
    if (type) {
        [api addParam:@"type" value:type];
    }
    [api addParam:@"index" value:@(index)];
    [api addParam:@"size" value:@(10)];
    return [api getRequest];
}
@end
